<?php

namespace app\api\controller\login;

use app\api\controller\Member;
use app\common\model\AssociationModel;

class Association extends Member
{
    /**
     * 获取社团文化列表
     */
    public function getAssociation(){
        $user = $this->getMember();
        $association = AssociationModel::where('school_id',$user['school_id'])
            ->order('sort asc,id desc')
            ->select();
        if (!empty($association)) {
            $this->success('获取社团文化列表成功！', $association, 200);
        } else {
            $this->error('获取社团文化列表失败！', '', 400);
        }
    }

    /**
     * 获取社团文化详情
     */
    public function getAssociationDetail(){
        $association_id = $this->request->get('association_id');
        $association = AssociationModel::where('id',$association_id)->find();
        $association['images'] = explode('|',$association['images']);
        if(!empty($association)){
            $this->success('获取社团文化成功！',$association,200);
        }else{
            $this->error('获取社团文化失败！','',400);
        }
    }


}
